perm filename REF.POX[POX,WD]2 blob sn#399481 filedate 1978-11-26 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	\|\\				Define Brick Character
C00009 ENDMK
C⊗;
\|\\;				Define Brick Character
\;
\⊂'000040;\;	VERREM - REM's syntax for defining macros with args 
\;
\	;\←'0;\→G\;	footnote numbers in notes
\	;\←'0;\→N\;	footnote numbers in text
\;	                Citation and Reference Macros
\;
\8CIT1(1)[\"[\!CIT(⊗1⊗);\"]]\;
\8CIT1B(1,LOC)[\"[\!CIT(⊗1⊗);,⊗LOC⊗\"]]\;
\8CIT2(1,2)[\"[\!CIT(⊗1⊗);,\!CIT(⊗2⊗);\"]]\;
\8CIT3(1,2,3)[\"[\!CIT(⊗1⊗);,\!CIT(⊗2⊗);,\!CIT(⊗3⊗);\"]]\;
\8CIT4(1,2,3,4)[\N
\	;\"[\!CIT(⊗1⊗);,\!CIT(⊗2⊗);,\!CIT(⊗3⊗);,\!CIT(⊗4⊗);\"]]\;
\8CIT5(1,2,3,4,5)[\N
\	;\"[\!CIT(⊗1⊗);,\!CIT(⊗2⊗);,\!CIT(⊗3⊗);,\!CIT(⊗4⊗);,\N
\	   ;\!CIT(⊗5⊗);\"]]\;
\8CIT6(1,2,3,4,5,6)[\N
	;\"[\!CIT(⊗1⊗);,\!CIT(⊗2⊗);,\!CIT(⊗3⊗);,\!CIT(⊗4⊗);,\N
\	   ;\!CIT(⊗5⊗);,\!CIT(⊗6⊗);\"]]\;
\8CIT7(1,2,3,4,5,6,7)[\N
\	;\"[\!CIT(⊗1⊗);,\!CIT(⊗2⊗);,\!CIT(⊗3⊗);,\!CIT(⊗4⊗);,\N
\	   ;\!CIT(⊗5⊗);,\!CIT(⊗6⊗);,\!CIT(⊗7⊗);\"]]\;
\8CIT8(1,2,3,4,5,6,7,8)[\N
\	;\"[\!CIT(⊗1⊗);,\!CIT(⊗2⊗);,\!CIT(⊗3⊗);,\!CIT(⊗4⊗);,\N
\	   ;\!CIT(⊗5⊗);,\!CIT(⊗6⊗);,\!CIT(⊗7⊗);,\!CIT(⊗8⊗);\"]]\;
\8CIT9(1,2,3,4,5,6,7,8,9)[\N
\	;\"[\!CIT(⊗1⊗);,\!CIT(⊗2⊗);,\!CIT(⊗3⊗);,\!CIT(⊗4⊗);,\N
\	   ;\!CIT(⊗5⊗);,\!CIT(⊗6⊗);,\!CIT(⊗7⊗);,\!CIT(⊗8⊗);,\N
\	   ;\!CIT(⊗9⊗);\"]]\;
\;
\8OBIND(N,A)[\oPSH[⊗A⊗]\∂⊗N⊗←PSH;]\;
\8OPOP(N)[\∂PSH←⊗N⊗;\∂←PSH;]\;
\;
\8FMTREF(TAG,TXT)[\N
\	;\P\QL\Q0\N			save ac, L, and 0
\	;\!OBIND(AA,(0⊗TAG⊗));\N
\	;\1AA;\→0\2AA;\+0\→0\N	measure width of tag
\	;\+L\→L\N			move L over that much
\	;\-0\→.\N
\	;⊗TAG⊗\N			output tag
\	;\J⊗TXT⊗\.
\	;\!OPOP(AA);\N
\	;\q0\qL\p]\;			restore 0, L, and ac
\;
\8MKREFTAG(I)[\N
\	;\P\Q0\N			save ac and reg 0
\	;\←=⊗I⊗;\N			
\	;\→0\N				store in 0
\	;\←=9;\N			subtract 9
\	;\¬0\N				
\	;\!COMPAC;\N			complement ac
\	;\?EVAL(( ));\N			print leading space
\	;[⊗I⊗]  \N
\	;\q0\p]\;			restore 0 and ac
\;
\8REF(NAME,TEXT)[\N
\	;\!INCR(CURREF);\N		increment CURREF
\	;\!EVAL((\∞REFNUM)\!CURREF;([)⊗NAME⊗(]));\N
\	;\N				name of current reference
\	;\!EVAL((\∞)⊗NAME⊗(CITNUM[0]));\N
\	;\N				init citation number
\	;\!EVAL((\∞)⊗NAME⊗(REFTEXT[⊗TEXT⊗]));\N
\	;\N				store reference text
\N\	;\!CIT(⊗NAME⊗);\N		***debug
\	;]\;
\;
\8NTHREF(NUM)[\!REFNUM⊗NUM⊗;]\;
\;
\8CIT(NAME)[\N
\	;\!EVAL((\←=)\!CITNUM(⊗NAME⊗);(;));\N	get number of citation
\	;\!COMPAC;\N				complement ac
\	;\?DEFCURCIT(⊗NAME⊗);\N			assign new cit numb
\	;\!CITNUM(⊗NAME⊗);\N			print out cit numb
\	;]\;
\;
\8DEFCURCIT(NAME)[\N		increment CURCIT and assign to name
\	;\!INCR(CURCIT);\N			increment CURCIT
\	;\!EVAL((\∞)⊗NAME⊗(CITNUM[)\!CURCIT;(]));\N
\	;\N					assign to name
\	;\!EVAL((\∞CITNUM)\!CURCIT;([)⊗NAME⊗(]));\N
\	;]\;
\;
\8CITNUM(NAME)[\!⊗NAME⊗CITNUM;]\;
\;
\8NTHCIT(NUM)[\!CITNUM⊗NUM⊗;]\;
\;
\8REFTEXT(NAME)[\!⊗NAME⊗REFTEXT;]\;
\;
\∞PRINTREFS[\N			print refs in order of citation
\	;\P\QT\N			save ac and reg T
\	;\←=0;\→T\N			set T to zero
\	;\!LOADAC(CURCIT);\N		upper bound of do loop in ac
\	;\IPRINTREF;\N			iterate on num of refs
\	;\qT\p]\;			restore T and ac
\;
\∞PRINTREF[\N			print out a reference
\	;\-=1;\N			decrement loop count
\	;\P\N				save ac
\	;\←T\+=1;\→T\N			increment cit count
\	;\!FMTREF(\!MKREFTAG(\DT);,\!REFTEXT(\!NTHCIT(\DT);););\N
\	;\N				do the work
\	;\p]\;				restore ac
\;
\∞CHECKREFS[\N			check for uncited references
\	;\P\Q0\Q1\N			save ac, reg 0, and reg 1
\	;\←=0;\→0\→1\N			setq regs 0 and 1 to 0
\	;\!LOADAC(CURREF);\N		set upper bound on loop
\	;\ICHECKREF;\N			check if ref was cited
\	;\←1\N				were there any
\	;\?EVAL((\m{unreferenced}));\N
\	;\N				type "unreferenced"
\	;\?EVAL((\m{)\A=13;\A=10;(}));\N
\	;\N				and a crlf
\	;\q1\q0\p]\;			restore regs and ac
\;
\∞CHECKREF[\N			was this ref cited
\	;\-=1;\N			decrement loop count
\	;\P\N				save ac
\	;\←0\+=1;\→0\N			increment count of references
\	;\!EVAL((\←=)\!CITNUM(\!NTHREF(\D0););(;));\N
\	;\N				load ac with citnum
\	;\!COMPAC;\N
\	;\?EVAL((\P\N					save ac
\		;\←1\N					fetch reg 1
\		;\!COMPAC;\N				if was zero
		;\?EVAL((\m{)\A=13;\A=10;\A=9;(}));	crlf & tab
		;\p));\N				restore ac
\	;\?EVAL((\P\←=1;\→1\p));\N	set "there were some" bit
\	;\?EVAL((\m{)\!NTHREF(\D0);( )(}));\N
\	;\p]\;
\;
\;\∞FN[\P\←N\+=1;\→N\∩\#\F7\DN\G\⊗\p]\;
\;
\;\8NOTE(TXT)[\P\←G\+=1;\→G\!FMTREF(\DG,(⊗TXT⊗));\p]\;
\;